import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OccupancyStatisticsVO, OccupancyStatisticsForm, OccupancyStatisticsQuery } from '@/api/nursing/occupancyStatistics/types';

/**
 * 查询入住率统计列表
 * @param query
 * @returns {*}
 */

export const listOccupancyStatistics = (query?: OccupancyStatisticsQuery): AxiosPromise<OccupancyStatisticsVO[]> => {
  return request({
    url: '/nursing/occupancyStatistics/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询入住率统计详细
 * @param statId
 */
export const getOccupancyStatistics = (statId: string | number): AxiosPromise<OccupancyStatisticsVO> => {
  return request({
    url: '/nursing/occupancyStatistics/' + statId,
    method: 'get'
  });
};

/**
 * 新增入住率统计
 * @param data
 */
export const addOccupancyStatistics = (data: OccupancyStatisticsForm) => {
  return request({
    url: '/nursing/occupancyStatistics',
    method: 'post',
    data: data
  });
};

/**
 * 修改入住率统计
 * @param data
 */
export const updateOccupancyStatistics = (data: OccupancyStatisticsForm) => {
  return request({
    url: '/nursing/occupancyStatistics',
    method: 'put',
    data: data
  });
};

/**
 * 删除入住率统计
 * @param statId
 */
export const delOccupancyStatistics = (statId: string | number | Array<string | number>) => {
  return request({
    url: '/nursing/occupancyStatistics/' + statId,
    method: 'delete'
  });
};
